package ${pkgName};

import java.io.Serializable;
import javax.validation.constraints.*;
//import com.farben.platform.dto.${className}RangeDTO;
<#list imports as im>
import ${im};
</#list>
import org.mybatis.hbatis.orm.criteria.support.query.AbstractQueryParam;
import org.mybatis.hbatis.orm.criteria.support.query.SortOrders;
/**
 * ${className} ${tableRemark}
 * @author generator
 * @date ${.now?date?string('yyyy年MM月dd日')}
 */
@Table(${className}.EntityNode.class)
public class ${className} implements Serializable {
	
	private static final long serialVersionUID = 1L;
	<#list fields as field>
	/**
	  * ${field.comment}
	  * nullable:${field.nullable?string('true','false')},length:${field.length}
	  */
	@Column(<#if field.primaryKey>primaryKey = true,</#if><#if field.autoIncrement>autoIncrement = true,</#if>comment = "${field.comment}")	
	<#if field.nullable==false>
	@NotNull
	</#if>
	private ${field.propType} ${field.name};
	</#list>
    <#list fields as field>
    public ${field.propType} get${getFieldMethodName(field.name)}(){
    	return this.${field.name};
    }
    public void set${getFieldMethodName(field.name)}(${field.propType} ${field.name}){
    	this.${field.name} = ${field.name};
    }
	</#list>
   	<#-- 多主键 -->
    <#if (primaryKeys?size>1)>
    public static class PK {
    	<#list primaryKeys as field>
		@Column(primaryKey = true,comment = "${field.comment}")
		@NotNull
		private ${field.propType} ${field.name};
		public ${field.propType} get${getFieldMethodName(field.name)}(){
	    	return this.${field.name};
	    }
	    public void set${getFieldMethodName(field.name)}(${field.propType} ${field.name}){
	    	this.${field.name} = ${field.name};
	    }
		</#list>
    }
    </#if>

    public static class EntityNode extends AbstractEntityNode<${className}> {
        public static final EntityNode INSTANCE = new EntityNode("${simpleTableName}");;
		<#list fields as field>
		<#if field.propType!='byte[]'>
    	/** ${field.comment} */
        public FieldNode<${className}, ${field.propType}> ${field.name} =  createFieldNode("${field.name}","${field.colName}",${field.propType}.class,JdbcType.${field.colTypeName});
    	</#if>
		</#list>
	
        /**
         * @param alias 别名
         */
        public EntityNode(String alias) {
            super(${className}.class,"${tableName}",alias);
        }
    }
    
    //-- 实体参数(允许新增属性) 
	public static class QueryParam extends AbstractQueryParam<${className}> {
        public  ${className}RangeDTO range;
        public  ${className}  likeParam;

		public QueryParam() {
			this.setSortOrders(new SortOrders<${className}>(EntityNode.INSTANCE));
		}
	}
	
	public static enum ValueField {
	}
    // ==== 自定义属性 ====
}